package com.phuc.game.tankshooter;

import com.phuc.game.tankshooter.common.Utility;
import com.phuc.game.tankshooter.engine.GamePlay;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class ResultActivity extends Activity {

	int score;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.result);

		score = getIntent().getExtras().getInt("Score");
		((TextView) findViewById(R.id.result_txtTotalScore)).setText("Tổng điểm : " + score);
		((TextView) findViewById(R.id.result_txtA)).setText("" + GamePlay.tankAKill);
		((TextView) findViewById(R.id.result_txtMole)).setText("" + GamePlay.tankMoleKill);
		((TextView) findViewById(R.id.result_txtT34)).setText("" + GamePlay.tankT34Kill);
		((TextView) findViewById(R.id.result_txtTiger)).setText("" + GamePlay.tankTigerKill);
		
		if (score > MenuActivity.maxScore) {
			MenuActivity.maxScore = score;
			((TextView) findViewById(R.id.result_txtTotalScore)).setTextColor(Color.RED);
		}
	}
	
	public void onBackClick(View v) {
		this.finish();
	}
	
	@Override
	protected void onDestroy() {
		super.onDestroy();
		Utility.unbindDrawable(findViewById(R.id.root));
		System.gc();
	}
}
